import random

# if语句
age = 12
# if语句与下方带缩进的代码为一个完整的代码块
if age >= 18:
    print("成年人，随心所欲")
else:
    print("未成年，好好学习")

# 逻辑运算符 and、or、not
# if age >= 0 and age <= 120
if 0 <= age <= 120:
    print("age正确")
else:
    print("年龄不正确")

python_score = 24
c_score = 12
if python_score >= 60 or c_score >= 60:
    print("通过考试")
else:
    print("成绩不合格")

is_employee = False
if not is_employee:
    print("不是本公司员工，禁止入内")

# if elif else
holiday_name = "生日"
if holiday_name == "情人节":
    print("买玫瑰，看电影")
elif holiday_name == "平安夜":
    print("买苹果，吃大餐")
elif holiday_name == "生日":
    print("买蛋糕")
else:
    print("每天都是节日")

# if语句嵌套
has_ticket = True
knife_length = 100
if has_ticket:
    print("允许进入，开始安检。。。")
    if knife_length <= 20:
        print("允许上车,旅途愉快")
    else:
        print("%dcm刀具不允许上车" % knife_length)
else:
    print("不允许进入")

# 从键盘输入石头(1) 剪刀(2) 布(3) 和电脑比对
player = int(input("请输入石头(1) 剪刀(2) 布(3)"))
computer = random.randint(1, 3)
# 判断代码过长可在条件上添加一对小括号然后or就可以换行
if ((player == 1 and computer == 2)
        or (player == 2 and computer == 3)
        or (player == 3 and computer == 1)):
    print("胜利")
elif player == computer:
    print("和局")
else:
    print("失败")

# 随机数
# 输出10<=n<=20
print(random.randint(10, 20))
# 永远输出10
print(random.randint(10, 10))
